{extend name="layouts/main" /}
{block name="link"}{/block}
{block name="content"}
<div class="layui-tab layui-tab-brief" lay-filter="demoTitle">
	<div class="layui-body layui-tab-content site-demo site-demo-body" style="top: 0px;left: 0px;">
		<div class="layui-tab-item layui-show">
			<div class="layui-main">
				<div id="LAY_preview">
					<div class="layui-fluid" style="position: relative;margin: 0 auto;padding: 0 0px;">
						<div class="layui-set">
							<div class="layui-set-from search-form">
								<form class="layui-form" action="">
									<div class="layui-form-item" style="margin-bottom: -8px;">
										<div class="layui-input-inline" style="margin-right: 5px;">
											<select name="status" id="status" lay-verify="required">
												<option value="" selected="selected">全部</option>
												<option value="1">已导出</option>
												<option value="0">未导出</option>
											</select>
										</div>
										<div class="layui-input-inline" style="margin-right: 5px;">
											<input type="hidden" name="node_id" value="{$node_id}">
											<input type="text" name="title" value="{:input('title')}" placeholder="搜索关键词" autocomplete="off" class="layui-input search-input">
										</div>
										<div class="layui-input-inline" style="width:80px">
											<button class="layui-btn" id="search" style="height: 36px;"><i class="layui-icon"></i></button>
										</div>
									</div>
								</form>
							</div>
						</div>
						<div class="layui-card" style="overflow-y: hidden;float: left;width: 100%;">
							<form class="layui-form" action="">
								<table class="layui-table" lay-filter="tableEvent">
									<colgroup>
										<col width="1">
										<col width="5%">
										<col width="6%">
										<col>
										<col>
										<col width="15%">
										<col width="8%">
										<col width="12%">
									</colgroup>
									<thead>
										<tr>
											<th><input type="checkbox" lay-skin="primary" id="allChoose" lay-filter="allChoose"></th>
											<th>ID</th>
											<th>序号</th>
											<th>标题</th>
											<th>url</th>
											<th>添加时间</th>
											<th>状态</th>
											<th>操作</th>
										</tr>
									</thead>
									<tbody>
										{volist name="list" id="info"}
										<tr>
											<td><input type="checkbox" lay-skin="primary" class="ids" name="ids[]" value="{$info.id}" lay-filter="c_one"></td>
											<td>{$info.id}</td>
											<td><input type="text" name="sort[{$info.id}]" value="{$info.sort}" class="layui-input sort" lay-filter="weight"></td>
											<td title="{$info.title}">{$info.title|cut_str=15}</td>
											<td title="{$info.url}">{$info.url|cut_str=25}</td>
											<td>{$info.create_time|date="Y-m-d H:i:s"}</td>
											<td>
												<!-- {$info.status_text} -->
												<input type="checkbox" class="switch" {if condition="$info['status'] eq 1"}checked="checked"{/if} url="{:url('setStatus')}" on="ids={$info.id}&status=1&model=html&type=3" off="ids={$info.id}&status=0&model=html&type=3" lay-skin="switch" lay-filter="switchTest" lay-text="已导|未导">
											</td>
											<td>
												<div class="layui-inline"><a class="layui-btn layui-btn-xs " href="javascript:;" onclick="x_admin_show('查看','{:url('data_view',array('id'=>$info['id'],'model_id'=>$model_id))}','','',1)"><i class="layui-icon layui-icon-edit"></i> 编辑</a></div>
												{if condition="$info['status'] eq 0"}
												<!-- <div class="layui-inline"><a class="layui-btn layui-btn-xs layui-btn-normal ajax-get" href="{:url('setStatus',array('model'=>'html','type'=>3,'ids'=>$info['id'],'status'=>1))}"><i class="layui-icon layui-icon-release"></i> 已导</a></div> -->
												{else/}
												<!-- <div class="layui-inline"><a class="layui-btn layui-btn-xs layui-btn-warm ajax-get" href="{:url('setStatus',array('model'=>'html','type'=>3,'ids'=>$info['id'],'status'=>0))}"><i class="layui-icon layui-icon-set-fill"></i> 未导</a></div> -->
												{/if}
												<div class="layui-inline"><a class="layui-btn layui-btn-xs layui-btn-danger confirm ajax-get" url="{:url('data_del',array('ids'=>$info['id']))}"><i class="layui-icon layui-icon-delete"></i> 删除</a></div>
											</td>
										</tr>
										{/volist}
										<tr>
											<td align="left" colspan="12" style="padding-left:0;">
												&nbsp;
												<div class="layui-inline"><a class="layui-btn layui-btn-sm ajax-post" target-form="sort" url="{:url('sort',['model'=>'html','type'=>3,])}" title="排序" >排序</a></div>
												<div class="layui-inline"><a class="layui-btn layui-btn-sm layui-btn-normal ajax-post" target-form="ids" url="{:url('setStatus',array('model'=>'html','type'=>3,'status'=>1))}">已导</a></div>
												<div class="layui-inline"><a class="layui-btn layui-btn-sm layui-btn-warm ajax-post" target-form="ids" url="{:url('setStatus',array('model'=>'html','type'=>3,'status'=>0))}">未导</a></div>
												<div class="layui-inline"><a href="javascript:;" class="layui-btn layui-btn-sm export">导出</a></div>
												<div class="layui-inline"><a class="layui-btn layui-btn-sm layui-btn-danger confirm ajax-post" target-form="ids" url="{:url('data_del')}">删除</a></div>
											</td>
										</tr>
									</tbody>
								</table>
							</form>
							<div id="page">
								<div class="layui-box layui-laypage layui-laypage-default">
									<div class="pagelistbox">
										{$list|raw}
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>
{/block}
{block name="js"}
<script type="text/javascript">
	$(function() {
        $("select[name='status']").val({$status|default = ''});
    });
	$('body').on('click', '.export', function() {
		var arr = [];
        $("input:checkbox[class='ids']:checked").each(function(i){
		   	arr.push($(this).val());
        });
		if (arr.length > 0) {
			data=arr.join("|");
			x_admin_show("导出","{:url('show')}?ids="+data+"&node_id={$node_id}&model_id={$model_id}","50%","60%",1)
		} else {
			layer.msg("请选择需要导出的数据",{icon: 2,time:2000});
		}
	});
</script>
{/block}